package com.wenheng.aop;

import com.wenheng.commer.DataSourceType;
import com.wenheng.hodel.DynamicDataSourceHolder;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Component
@Aspect
@Slf4j
public class DataSourceAspect extends AbstractDataSourceAop{


    @Override
    public void doDataSource(JoinPoint joinPoint) {
        switch (getMthodTableType(joinPoint)) {
            case DataSourceType.arsmanagesupport: DynamicDataSourceHolder.putDataSource(DataSourceType.arsmanagesupport);
                break;
            default:
                DynamicDataSourceHolder.putDataSource(DataSourceType.master);
        }
    }
}
